/**
*	@file Affects.h
*
*	@brief this header file is to define Affect range table
*
*	@author li yuchen & lan ziquan
*
*	@date 1/28/2011
*/
#ifndef AFFECTS_H
#define AFFECTS_H
#include "StmtTable.h"
#include "BlkTable.h"
#include "Modifies.h"
#include "Uses.h"
#include "Next.h"
#include <vector>


class Affects{
public:
	static void			RebuildAffects();

	static bool			IsAffects(StmtNum assign_num_left, StmtNum assign_num_right);
	static bool			IsAffectsAdv(StmtNum assign_num_left, StmtNum assign_num_right);

	static string		ToString();

	
private:
	static AssignSet&	GetAffectsRight(AssignNum assign_num_left);
	static AssignSet&	GetAffectsLeft(AssignNum assign_num_right);

	static vector<AssignSet>	affects_table_;
	static vector<AssignSet>	affects_table_t_;
	static AssignSet			affects_has_a0_cache_;
	static AssignSet			affects_has_0a_cache_;
	static AssignSet			affects_has_a0_;
	static AssignSet			affects_has_0a_;
	static bool					affects_has_00_;
	static bool					affects_has_00_cache_;

	static vector<AssignSet>	affect_star_cache_;
	static vector<AssignSet>	affect_star_cache_hit_;

	static bool AccessAffectsAdvCache(AssignNum assign_left, AssignNum assign_right, bool value, bool set_cache);
	static bool AffectAdvCacheModified(AssignNum assign_left, AssignNum assign_right);

	static void CacheAffectAdv(AssignSet& set, AssignNum index, bool is_row, bool is_complete);
};

#endif
